/*
 * file.cpp
 *
 *  Created on: 11.11.2011
 *      Author: krasko
 */

#include "file.h"
#include <string>
#include <stdio.h>

File::File(const File & f) {
}

File & File::operator =(const File & rhs) {
	return *this;
}

File::File(const std::string & name) {
	f = fopen(name.c_str(), "w");
	opened = true;
}

void File::close() {
	if(opened) {
		fclose(f);
		opened = false;
	}
}

File::~File() {
	close();
}

File & operator <<(File & out, const int value) {
	fprintf(out.f, "%d", value);
	return out;
}

File & operator <<(File & out, const std::string & str) {
	fprintf(out.f, "%s", str.c_str());
	return out;
}

